﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="chngmp.aspx.cs" Inherits="jeward.changemasterpage.chngmp" DynamicMasterPageFile="~masterurl/default.master" %>

<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <script src="/_layouts/jeward/js/chngmp.js" type="text/javascript"></script>
    <script type="text/javascript">
        function getGlobalCommands() {
            return ['jwRibbon.Command1', 'jwRibbon.Command2', 'jwRibbon.Command3'];
        }
    </script>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <wssuc:InputFormSection ID="InputFormSection2" Title="Change Master page" runat="server"
            Description="Select mater page to change. <br/> And if you want doesn't appear in the drop-down list, press the sync button sync with all the root site master pages.">
	        <Template_InputFormControls>
                <wssuc:InputFormControl ID="InputFormControl1" LabelText="Current master page is:" LabelAssociatedControlID="lblCrntmp" runat="server">
			     <Template_Control>
				    <asp:Label runat="server" ID="lblCrntmp" />
			     </Template_Control>
		        </wssuc:InputFormControl>
                <wssuc:InputFormControl ID="InputFormControl2" LabelText="Select mater page to change" LabelAssociatedControlID="ddlmp" runat="server">
			     <Template_Control>
				    <asp:DropDownList ID="ddlmp" runat="server" Width="200px">
                    </asp:DropDownList>
			     </Template_Control>
		        </wssuc:InputFormControl>
	        </Template_InputFormControls>
        </wssuc:InputFormSection>
        <wssuc:ButtonSection ID="ButtonSection1" runat="server" ShowStandardCancelButton="false">
		    <Template_Buttons>
			    <asp:Button runat="server" class="ms-ButtonHeightWidth"
                    Text="Change" id="btnChange" OnClick="btnChange_Click" />
                <asp:Button runat="server" class="s4-die"
                    Text="Sync" id="btnSync" OnClick="btnSync_Click" />
			    <asp:Button runat="server" class="ms-ButtonHeightWidth"
                    Text="Close" id="btnClose" OnClientClick="chngmp_Close_Click(); return false;" />
		    </Template_Buttons>
        </wssuc:ButtonSection>
    </table>
    <input type="hidden" id="hdnResult" value="" runat="server" />
    <input type="hidden" id="hdnComeout" value="" runat="server" />
    <script type="text/javascript">
        var result = document.getElementById("<%=hdnResult.ClientID%>").value;
        if (result == "success") {
            SP.SOD.executeOrDelayUntilScriptLoaded(function () { chngmp_addNotify("<%=hdnComeout.ClientID%>") }, 'sp.js');
        }
    </script>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Change Master Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    <a href="../settings.aspx">
        <SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" Text="<%$Resources:wss,settings_pagetitle%>"
            EncodeMethod="HtmlEncode" />
    </a>&#32;
    <SharePoint:ClusteredDirectionalSeparatorArrow ID="ClusteredDirectionalSeparatorArrow1" runat="server" />
    Change Master Page
</asp:Content>

<asp:Content ID="TitleBreadcrumb" ContentPlaceHolderID="PlaceHolderTitleBreadcrumb" runat="server">
    <SharePoint:ListSiteMapPath 
        ID="ListSiteMapPath1"
        runat="server" 
        SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"
        RenderCurrentNodeAsLink="false"
        PathSeparator=""
        CssClass="s4-breadcrumb" 
        NodeStyle-CssClass="s4-breadcrumbNode"
        CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode"
        RootNodeStyle-CssClass="s4-breadcrumbRootNode"
        HideInteriorRootNodes="true"
        SkipLinkText="" />
</asp:Content>
